package com.bw.test;

import com.bw.entity.Role;
import com.bw.entity.User;
import org.springframework.beans.factory.annotation.Autowire;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Scope;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by qpx on 2018/5/23.
 */
@Configuration
public class config {
    @Bean(initMethod="init",destroyMethod="destroy",autowire = Autowire.BY_TYPE)
    @Scope(value = "prototype")
    public Role role(){
        Role role = new Role();
        role.setName("张三");
        return role;
    }

    @Bean
    public User user(){
        User user = new User();
        user.setName("lisi");
        return user;
    }

    @Bean
    public List list(){
        List list = new ArrayList();
        list.add(1);
        list.add(2);
        return list;
    }
    @Bean
    public Map map(){
        Map<String,Object> map = new HashMap<String,Object>();
        map.put("name","zhangsan");
        map.put("age",18);
        return map;

    }

}
